#include "course.h"
//test

course::course()
{

}

void course::setCourseInfo(QString courseSelectId, QString courseId, QString courseName, QString courseClass, QString courseCredit, QString courseCharacter, QString courseCollege, QString courseTeacherName, QString courseTeacherLevel, QString courseTime, QString courseAddress, QString courseMaxStudent, QString courseCurrentStudent)
{
    this->courseSelectId=courseSelectId;
    this->courseId=courseId;
    this->courseName=courseName;
    this->courseClass=courseClass;
    this->courseCredit=courseCredit;
    this->courseCharacter=courseCharacter;
    this->courseCollege=courseCollege;
    this->courseTeacherName=courseTeacherName;
    this->courseTeacherLevel=courseTeacherLevel;
    this->courseTime=courseTime;
    this->courseAddress=courseAddress;
    this->courseMaxStudent=courseMaxStudent;
    this->courseCurrentStudent=courseCurrentStudent;
}

void course::displayThisCourse(QStandardItemModel *model, int curRow) const
{
    model->setItem(curRow,0,new QStandardItem(courseSelectId));
    model->setItem(curRow,1,new QStandardItem(courseId));
    model->setItem(curRow,2,new QStandardItem(courseName));
    model->setItem(curRow,3,new QStandardItem(courseClass));
    model->setItem(curRow,4,new QStandardItem(courseCredit));
    model->setItem(curRow,5,new QStandardItem(courseCharacter));
    model->setItem(curRow,6,new QStandardItem(courseCollege));
    model->setItem(curRow,7,new QStandardItem(courseTeacherName));
    model->setItem(curRow,8,new QStandardItem(courseTeacherLevel));
    model->setItem(curRow,9,new QStandardItem(courseTime));
    model->setItem(curRow,10,new QStandardItem(courseAddress));
    model->setItem(curRow,11,new QStandardItem(courseMaxStudent));
    model->setItem(curRow,12,new QStandardItem(courseCurrentStudent));
}

QString course::getCourseSelectId() const
{
    return this->courseSelectId;
}

QString course::getCourseName() const
{
    return this->courseName;
}

QString course::getCourseTime() const
{
    return this->courseTime;
}

void course::peoplePlusOne()
{
    int count=this->courseCurrentStudent.toInt()+1;
    QString temp=QString::number(count);
    this->courseCurrentStudent=temp;
}

void course::peopleMinOne()
{
    int count=this->courseCurrentStudent.toInt()-1;
    QString temp=QString::number(count);
    this->courseCurrentStudent=temp;
}

QStringList course::getAllInfo() const
{
    QStringList allInfo;
    allInfo.append(courseSelectId);
    allInfo.append(courseId);
    allInfo.append(courseName);
    allInfo.append(courseClass);
    allInfo.append(courseCredit);
    allInfo.append(courseCharacter);
    allInfo.append(courseCollege);
    allInfo.append(courseTeacherName);
    allInfo.append(courseTeacherLevel);
    allInfo.append(courseTime);
    allInfo.append(courseAddress);
    allInfo.append(courseMaxStudent);
    allInfo.append(courseCurrentStudent);
    return allInfo;
}
